using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace TankWars.Weapons
{
    class PlasmaBall : Shot
    {
        private const int N_PLASMA_POWER = 20;
        public const int N_TIME_BETWEEN_FIRING = 1800;
        public const int N_CHARGE_COST_PER_FIRE = 10;
        public const WeaponManager.WeaponCategory SHOT_CATEGORY = WeaponManager.WeaponCategory.Energy;

        private float fSpeed = 160.0f;

        public PlasmaBall(Tank firingTank, Texture2D plasmaballSprite) 
            : base(plasmaballSprite)
        {
            base.FiringTank = firingTank;

            base.nPower = N_PLASMA_POWER;

            //Set the position and rotation of the missle to the tank.
            base.fRotation = firingTank.Turret.fRotation;
            base.vPosition = firingTank.Turret.EndOfTurret;
            this.highGround = base.FiringTank.highGround;   //Set bullet to same level as tank.
            base.vPosition.X += (base.SpriteWidth / 2) * (float)Math.Cos(base.fRotation);
            base.vPosition.Y += (base.SpriteWidth / 2) * (float)Math.Sin(base.fRotation);

            //Set the speed of the missle relative to its rotation.
            base.vSpeed.X = (float)(this.fSpeed * Math.Cos(base.fRotation));
            base.vSpeed.Y = (float)(this.fSpeed * Math.Sin(base.fRotation));

            //Should the tank's velocity be added on to this weapon?
            //vSpeed += base.FiringTank.vSpeed;
        }

        public PlasmaBall(Tank firingTank, Texture2D plasmaballSprite, string strSpriteName, string strFrameXMLFile)
            : base(strSpriteName, plasmaballSprite, strFrameXMLFile)
        {
            base.FiringTank = firingTank;

            base.nPower = N_PLASMA_POWER;

            base.strExplodeAnimationLabel = "PlasmaExplosion";

            //Set the position and rotation of the missle to the tank.
            base.fRotation = firingTank.Turret.fRotation;
            base.vPosition = firingTank.Turret.EndOfTurret;
            this.highGround = base.FiringTank.highGround;   //Set bullet to same level as tank.
            base.vPosition.X += (base.SpriteWidth / 2) * (float)Math.Cos(base.fRotation);
            base.vPosition.Y += (base.SpriteWidth / 2) * (float)Math.Sin(base.fRotation);

            //Set the speed of the missle relative to its rotation.
            base.vSpeed.X = (float)(this.fSpeed * Math.Cos(base.fRotation));
            base.vSpeed.Y = (float)(this.fSpeed * Math.Sin(base.fRotation));

            //Should the tank's velocity be added on to this weapon?
            //vSpeed += base.FiringTank.vSpeed;
        }
    }
}
